55 #ifdef INCLUDE_DEBUG_FUNCTIONS 59 volatile static uint16_t iTestProgress;
60 volatile static uint16_t iTestDelay = 0;
61 volatile static uint16_t iTestAngle = 0;
62 volatile float angle=0.0f;
63 volatile static float threshold=0;
165 switch (quaternionPacketType) {
168 CurrentQ = sfg->SV_3DOF_G_BASIC.fLPq;
169 qAeqAxB(&(sfg->SV_3DOF_G_BASIC.fLPq), &ftmpq);
174 CurrentQ = sfg->SV_3DOF_B_BASIC.fLPq;
175 qAeqAxB(&(sfg->SV_3DOF_B_BASIC.fLPq), &ftmpq);
180 CurrentQ = sfg->SV_3DOF_Y_BASIC.fq;
181 qAeqAxB(&(sfg->SV_3DOF_Y_BASIC.fq), &ftmpq);
186 CurrentQ = sfg->SV_6DOF_GB_BASIC.fLPq;
187 qAeqAxB(&(sfg->SV_6DOF_GB_BASIC.fLPq), &ftmpq);
192 CurrentQ = sfg->SV_6DOF_GY_KALMAN.fqPl;
193 qAeqAxB(&(sfg->SV_6DOF_GY_KALMAN.fqPl), &ftmpq);
196 #if F_9DOF_GBY_KALMAN 198 CurrentQ = sfg->SV_9DOF_GBY_KALMAN.fqPl;
199 qAeqAxB(&(sfg->SV_9DOF_GBY_KALMAN.fqPl), &ftmpq);
211 switch (iTestProgress) {
220 StartingQ.
q0 = CurrentQ.
q0;
221 StartingQ.
q1 = -1 * CurrentQ.
q1;
222 StartingQ.
q2 = -1 * CurrentQ.
q2;
223 StartingQ.
q3 = -1 * CurrentQ.
q3;
228 qAeqAxB(&CurrentQ, &StartingQ);
230 angle = fmod(fabs(angle), 180.0);
231 iTestAngle = (uint16_t) (10 * angle);
237 if (angle<threshold) iTestProgress=2;
238 if (angle < (0.2 * threshold)) iTestProgress=0;
239 if (iTestDelay>100) iTestProgress=0;
enum quaternion quaternion_type
the quaternion type to be transmitted
Quaternion derived from full 9-axis sensor fusion.
#define ONEOVERSQRT2
1/sqrt(2)
Quaternion derived from 3-axis mag only (auto compass algorithm)
The top level fusion structure.
float q3
z vector component
Quaternion derived from 3-axis gyro only (rotation)
Quaternion derived from 3-axis accel + 3 axis mag (eCompass)
Quaternion derived from 3-axis accel + 3-axis gyro (gaming)
struct ControlSubsystem * pControlSubsystem
quaternion structure definition
void ApplyPerturbation(SensorFusionGlobals *sfg)
The ApplyPerturbation function applies a user-specified step function to prior fusion results which i...
The sensor_fusion.h file implements the top level programming interface.
#define F180OVERPI
radians to degrees conversion = 180 / pi
Quaternion derived from 3-axis accel (tilt)
Defines control sub-system.
SensorFusionGlobals sfg
This is the primary sensor fusion data structure.
float q2
y vector component
void qAeqAxB(Quaternion *pqA, const Quaternion *pqB)
function compute the quaternion product qA = qA * qB
float q1
x vector component
volatile uint8_t iPerturbation
test perturbation to be applied
volatile quaternion_type QuaternionPacketType
quaternion type transmitted over UART